<?php

include '../newlib.php';
include '../lib/AppScope.pre.php';

	$program = $_REQUEST["program"];
	$dur = $_REQUEST["dur"];
	$params = array();
	$params[":theUser"] = $app->theUser;
	$params[":titel"] = $_REQUEST["titel"];
	$params[":inhoud"] = str_replace("\n", "<br />", $_REQUEST["inhoud"]);
	$params[":background"] = intval($_REQUEST["background"]);
	$params[":special"] = intval($_REQUEST["special"]);
	$params[":id"] = intval($_REQUEST["page"]);

	$sql = "update content set titel=:titel, inhoud=:inhoud, background=:background, special=:special, modifier=:theUser, modified=now(), dur=:dur where id=:id";
	if (empty($dur)) {
		$sql = "update content set titel=:titel, inhoud=:inhoud, background=:background, special=:special, modifier=:theUser, modified=now() where id=:id";
	} else {
		$params[":dur"] = $dur;
	}
	$stm = $tmpConnection->prepare($sql);
	$stm->execute($params);
	
	header("Location: editprog.php" . "?program=" . $program);

?>